﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace AgendaFinanceira
{
    public class ConexaoBanco
    {
        public SqlConnection ConectaBanco()
        {
            SqlConnection cn = new SqlConnection();
            cn.ConnectionString = @"Data Source='Data Source='C:\Users\The''s\Projetos\AgendaFinanceira\bdaFinancas.sdf'";
            cn.Open();
            return cn;
        }
        public static List<string> carregarLista()
        {
            string cat = "";
            List<string> listaRetorno = new List<string>();
            SqlConnection cn = ConectaBanco();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "Select * from Categoria";
            cmd = cn.CreateCommand();
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                cat = dr["DescricaoCategoria"].ToString();
                listaRetorno.Add(cat);
            }

            return listaRetorno;
        }
        public static void insert()
        {
            string cat = "";
            List<string> listaRetorno = new List<string>();
            SqlConnection cn = ConectaBanco();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "Insert categoria into categoria ";
            cmd = cn.CreateCommand();
            cmd.ExecuteNonQuery();
           
        }


    }
}
